Sequence Diagram for the Elevator System
Visualize the sequence diagram for calling the elevator, and solve a challenge.
We'll cover the following
A sequence diagram is a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our elevator system. In this lesson, we will create sequence diagrams for the following two interactions:
Elevator call: The passenger calls the elevator.
Sequence challenge: The passenger rides the elevator to a floor.
Elevator call#
The sequence diagram for an elevator call should have the following actors and objects that will interact with each other:
Actor:
Passenger
Objects:
HallButton
,HallButton
,ElevatorSystem
,Dispatcher
,ElevatorCar
, andDoor
Here are the steps in the elevator call interaction:
The passenger presses the hall button to call the elevator.
The hall button signals the elevator system to call an elevator car to the passenger's floor.
The elevator system informs the dispatcher to select the best car.
The dispatcher returns the best car to the system.
The elevator system signals the elevator car to move to the passenger's floor.
The elevator car signals the system when it arrives on the floor.
The system signals the hall button that the elevator has arrived.
The hall button is unpressed.
The elevator system signals the doors to open.
The door opens for the passenger.
Based on the order above, the sequence diagram for an elevator call in the elevator system is given below.
Sequence challenge: Elevator ride#
You will complete a sequence diagram for an elevator ride from one floor to another. A skeleton of the sequence diagram for an elevator ride is given below:
Notice that the arrows in the diagram above are numbered from 1 to 9. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of order they should appear in the skeleton of the sequence diagram above?
Note: If you get stuck, just click the “Show Solution” button to check the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to see the complete sequence diagram for the elevator ride interaction.
Next, let’s look at the activity diagrams for the elevator system to understand the control flow of the system.
Class Diagram for the Elevator System
Activity Diagram for the Elevator System